using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CBulletShoot : MonoBehaviour
{
   [SerializeField]
   private GameObject m_bulletInstance;
   [SerializeField]
   private GameObject m_player;
   [SerializeField]
   private GameObject m_bullet;

   public void Shoot()
   {  
      m_bullet=(GameObject)Resources.Load("Prefabs/BlueBullet");
      if(this.m_player != null){Debug.LogError("Player has not been instantiated");}
      if (m_bullet != null)
      {
         UnityEngine.Object.Instantiate<GameObject>(m_bullet,this.m_player.transform.position+0.2f*this.m_player.transform.right,
            Quaternion.Euler(this.m_player.transform.eulerAngles+new Vector3(0f,0f,180f)));
      }
      else
      {
         Debug.LogError("Failed to load bullet prefab from Resources.");
      }
   }
}
